<?php

namespace Common\Model;

/**
 * DistrictModel.class实例模型
 * 
 * @author songanwei
 * @date 2016-1-5
 */
class DistrictModel extends BaseModel {

    protected $trueTableName = 'bk_district';

    /**
     * 返回当前城市的所有区域
     * @modify songanwei 2016-01-04
     * @param integer $cityId
     * @return type
     */
    public function getAllByCity($cityId) {
        $where = array(
            'city_id' => $cityId,
            'isdelete' => 0
        );
        return $this->where($where)->select();
    }

    /**
     * 返回区域名称
     * @param integer $districtId  区域ID
     * @return type
     */
    public function getName($districtId) {
        return $this->where(array('id' => $districtId))->getField('name');
    }

}
